<template>
	<view class="flexDeCo">
		<template v-for="(item,index) in dataList">
			<view class="DaziCommunityNearTour flex" style="flex-wrap: wrap;">
				<!-- <image @tap="goToNewPage(item, 'd')"
					:src="item.coverList && item.coverList.length > 0 ? item.coverList[0] : 'https://hilton-duoladuo.oss-cn-shenzhen.aliyuncs.com/basic-common/upload/680ae589463da387fd39ef10.jpg'" mode=""
					style="width: 120rpx;height: 120rpx;"></image> -->
				<image @tap="goToNewPage(item, 'u')"
					:src="item.creatorAvatar != null && item.creatorAvatar != '' ? item.creatorAvatar : 'https://hilton-duoladuo.oss-cn-shenzhen.aliyuncs.com/basic-common/upload/680ae589463da387fd39ef10.jpg'"
					mode="" style="width: 88rpx;height: 88rpx; "></image>
				<view class="right flexDeCo" style="width: auto;">
					<view class="r_top flex title" @tap="goToNewPage(item, 'd')">{{ item.title | truncate(20) }}</view>
					<view class="r_bottom flex_jcsb">
						<view class="rb_left">
							<view v-if="item.creator != null && item.creator != ''" @tap="goToNewPage(item, 'u')">
								{{item.creator}}
							</view>
							<view v-else>
								无名
							</view>

						</view>
						<view class="rb_right">{{item.createTime}}</view>
					</view>
				</view>
				<view v-if="item.coverList.length > 0" @tap="goToNewPage(item, 'd')"
					style="width: 100%; display: flex; margin-top: 40rpx; justify-content: flex-end; gap: 20rpx;">
					<view v-for="(items,index) in item.coverList" class="dzimg">
						<img style="height: 140rpx; width: 140rpx;"
							:src="!items?'https://hilton-duoladuo.oss-cn-shenzhen.aliyuncs.com/basic-common/upload/680ae589463da387fd39ef10.jpg':items"></img>
					</view>
				</view>
			</view>
		</template>
	</view>
</template>

<script>
	import {
		navigateTo
	} from '../../utils/promise';

	export default {
		name: "DaziCommunityNearTour",
		props: {
			dataList: {
				type: Array,
			},
		},
		data() {
			return {

			};
		},
		filters: {
			truncate(value, length) {
				if (!value) return ''
				if (value.length > length) {
					return value.substring(0, length) + '...'
				}
				return value
			}
		},
		mounted() {
			console.log(this.dataList)
		},
		methods: {
			goToNewPage(item, flag) {
				// console.log(item)
				this.$emit("gotoNewPage")

				if (flag == 'd') {
					navigateTo({
						// url: `/pages/PartnerActivitiesPage/PartnerActivitiesPage?id=${item.id}&type=${item.type}`
						url: `/pages/PartnerActivitiesPage/PartnerActivitiesPage?id=` + item.id
					})
				} else if (flag == 'u') {
					navigateTo({
						url: `/pages/NanChangPage/NanChangPage?id=` + item.userId
					})
				}

				// if (item.type == 111) {
				// 	navigateTo({
				// 		url: `/pages/ArticleDetails/ArticleDetails?id=` + item.id
				// 	})
				// } else {
				// 	navigateTo({
				// 		url: `/pages/NanChangPage/NanChangPage?id=` + item.userId
				// 	})
				// }

				// /pages/PartnerActivitiesPage/PartnerActivitiesPage?id='+bbslist[0].id)
			}
		}
	}
</script>

<style lang="less" scoped>
	@import "../../static/commonStyleLess/grayBox.less";

	.DaziCommunityNearTour {
		width: 690rpx;
		box-sizing: border-box;
		border-radius: 16rpx;
		background: #FFFFFF;
		margin: 20rpx auto 0 auto;
		padding: 30rpx;
		font-family: 'PingFang SC';
		font-weight: 400;
		letter-spacing: -0.82rpx;

		.left {
			// width: 120rpx;
			// height: 120rpx;
			// border-radius: 8rpx;
			// background: #D9D9D9;
		}

		.right {
			margin-left: 20rpx;
			flex: 1;

			.r_top {
				display: flex;
			}

			.title {
				font-weight: bold;
				font-size: 26rpx;
				// margin-top: 10rpx;
			}

			.r_bottom {
				font-size: 26rpx;
				color: #979797;
				margin-top: 32rpx;

				.rb_left {
					text-align: left;
					width: 260rpx;
					white-space: nowrap;
					overflow: hidden;
					text-overflow: ellipsis;
				}

			}
		}

	}
</style>